﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace StarForce {
    [CreateAssetMenu(menuName = "Card Config Parameters")]
    public class UiCardParameters : ScriptableObject {
        [SerializeField] [Tooltip("卡牌弯曲的总角度")] [Range(0,60)]
        private float hentAngle;
        [SerializeField] [Tooltip("x 轴上每张卡牌的间隙")]
        private float spacing;
        [SerializeField] [Tooltip("每张牌之间的高度差")] [Range(0f,1f)]
        private float height;
        [SerializeField] [Tooltip("卡牌旋转的速度")] [Range(0,60)]
        private float rotationSpeed;
        [SerializeField] [Tooltip("卡牌移动速度")] [Range(0,15)]
        private float movementSpeed;
        [SerializeField] [Tooltip("卡牌缩放速度")] [Range(0,15)]
        private float scaleSpeed;
        [Header("绘制")] [SerializeField] [Range(0, 1)] [Tooltip("绘制卡牌时候的大小")]
        float startSizeWhenDraw;
        [SerializeField] [Tooltip("高亮卡牌")] [Range(0.9f, 2f)]
        float hoverScale;
        [Header("悬浮")] [SerializeField] [Tooltip("卡牌悬浮的时的高度")] [Range(0, 4)]
        float hoverHeight;
        [SerializeField] [Range(0, 25)] [Tooltip("悬浮的速度")]
        float hoverSpeed;
        [Header("不启用")] [SerializeField] [Tooltip("当不启用时卡牌的透明度")] [Range(0.1f,1f)]
        private float disableAlpha;
        [Header("丢弃卡牌")] [SerializeField] [Tooltip("丢弃卡牌时的缩放大小")] [Range(0,1)]
        private float discardedSize;
        /// <summary>
        /// 卡牌弯曲的总角度
        /// </summary>
        public float BentAngle {
            get => hentAngle;
            set => hentAngle = value;
        }
        /// <summary>
        /// 卡牌的间隙
        /// </summary>
        public float Spacing {
            get => spacing;
            set => spacing = -value;
        }
        /// <summary>
        /// 卡牌高度
        /// </summary>
        public float Height {
            get => height;
            set => height = value;
        }
        
        /// <summary>
        /// 卡牌旋转的速度
        /// </summary>
        public float RotationSpeed {
            get => rotationSpeed;
            set => rotationSpeed = value;
        }

        /// <summary>
        /// 卡牌移动速度
        /// </summary>
        public float MovementSpeed {
            get => movementSpeed;
            set => movementSpeed = value;
        }
        /// <summary>
        /// 卡牌缩放速度
        /// </summary>
        public float ScaleSpeed {
            get => scaleSpeed;
            set => scaleSpeed = value;
        }

        /// <summary>
        /// 开始绘制卡牌时的大小
        /// </summary>
        public float StartSizeWhenDraw
        {
            get => startSizeWhenDraw;
            set => startSizeWhenDraw = value;
        }
        /// <summary>
        /// 悬浮缩放
        /// </summary>
        public float HoverScale
        {
            get => hoverScale;
            set => hoverScale = value;
        }
        /// <summary>
        /// 悬浮高度
        /// </summary>
        public float HoverHeight
        {
            get => hoverHeight;
            set => hoverHeight = value;
        }
        /// <summary>
        /// 悬浮运动速度
        /// </summary>
        public float HoverSpeed
        {
            get => hoverSpeed;
            set => hoverSpeed = value;
        }
        /// <summary>
        /// 不启用时的透明度
        /// </summary>
        public float DisableAlpha {
            get => disableAlpha;
            set => disableAlpha = value;
        }
        /// <summary>
        /// 丢弃卡牌时的缩放
        /// </summary>
        public float DiscardedSize {
            get => discardedSize;
            set => discardedSize = value;
        }
        
#if UNITY_EDITOR
        private event Action onValidataEvent = () => { };

        public Action OnValidataEvent {
            get => onValidataEvent;
            set => onValidataEvent = value;
        }

        void OnValidate()
        {
            onValidataEvent?.Invoke();
        }

#endif
    }
}
